package game.entity.action;

import edu.monash.fit2099.engine.Action;
import edu.monash.fit2099.engine.Actor;
import edu.monash.fit2099.engine.GameMap;
import edu.monash.fit2099.engine.Location;
import game.util.LocationUtil;

import java.util.Random;

/**
 * Special Action for attacking other Actors.
 */
public class DeathAction extends Action {

	/**
	 * The Actor that is to be attacked
	 */
	protected Actor target;
	/**
	 * Random number generator
	 */
	protected Random rand = new Random();

	/**
	 * Constructor.
	 *
	 * @param target the Actor to attack
	 */
	public DeathAction(Actor target) {
		this.target = target;
	}

	@Override
	public String execute(Actor actor, GameMap map) {
		Location location = map.locationOf(target);
		String locationPrettyString = LocationUtil.getLocationPrettyString(location);

		map.removeActor(actor);
		return locationPrettyString + target + " is dead";
	}

	@Override
	public String menuDescription(Actor actor) {
		return actor + " attacks " + target;
	}


}
